#ifndef __DEVICE_DEMO_H_
#define __DEVICE_DEMO_H_
#include <sys/time.h>
#include "config.h"
#include "device_def.h"
#include "libprotocol.h"
#include "CircularBuffer.h"

typedef enum devSpecSig{
  SPEC_SIG_STRAIN         = 0x05,
  SPEC_SIG_VIBRATION      = 0x06,
}devSpecSig_t;

typedef enum devSpecOpCode1{
  SPEC_OP1_SET_WORKMODE   = 0x04,
  SPEC_OP1_GET_STRAIN     = 0x05,
  SPEC_OP1_GET_VIBRATION  = 0x06,
}devSpecOpCode1_t;

typedef enum acqNodeType{
  STRAIN_NODE = 0,
  VIBRATION_NODE,
}acqNodeType_t;

#pragma pack(1)
typedef struct strainInfo{
  int             devId;
  float           strainAdCh1;
  float           strainAdCh2;
  float           strainVal;
  struct timeval  timeStamp;
}strainInfo_t;
#pragma pack()

#pragma pack(1)
typedef struct vibrationInfo{
  int             devId;
  float           temperature;
  float           accSpeedX;
  float           accSpeedY;
  float           accSpeedZ;
  float           angleX;
  float           angleY;
  float           angleZ;
  struct timeval  timeStamp;
}vibrationInfo_t;
#pragma pack()

int requirSetWorkMode(int devId, acqNodeType_t acqNodeType, int dataCnt);
int requirGetStrain(int devId, strainInfo_t *strainInfo, int nodeDataCnt);
int requirGetVibration(int devId, vibrationInfo_t *vibrationInfo, int nodeDataCnt);
int testStrain(int devId);
int testVibration(int devId);
#endif /*__DEVICE_DEMO_H_*/
